package com.cll.prototype.email.controller;


import com.cll.prototype.common.dto.AjaxResult;
import com.cll.prototype.api.email.service.ISendEmailLogService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 * 邮件发送日志
 * @author CLL
 * @since 2020-10-27
 */
@RestController
@RequestMapping("/send_email_log")
public class SendEmailLogController {

    private static final Logger logger = LoggerFactory.getLogger(SendEmailLogController.class);

    @Autowired
    private ISendEmailLogService sendEmailLogService;

    @PostMapping(value = "/sendEmailCaptcha")
    public AjaxResult sendEmailCaptcha(@RequestParam("email") String email,
                                       @RequestParam("captcha") String captcha){
        logger.info("===>>> 邮件服务发送注册验证码邮件");
        return sendEmailLogService.sendAndRecord(email, "注册验证码", captcha);
    }

}
